package main

import (
	"errors"
	"log"

	"gitee.com/z1gotool/z1err"
)

func main() {
	defer z1err.Handle(nil, func(err error) {
		log.Println(err)
		log.Println(`-----------`)
		log.Println(z1err.StackPrint(err, 0))
		log.Println(`-----------`)
		log.Println(z1err.Is(err, `this is s test err`, `main.func1`))
		log.Println(`-----------`)
		log.Println(z1err.Is(err, `this is s test err`, `/lib1.func1`))
	})

	log.Println(`-----------`)
	func3()
}

func func3() {
	func2()
}

func func2() {
	func1()
}

func func1() {
	// panic(errors.New(`this is s test err`))
	err := errors.New(`this is s test err`)
	z1err.Check(err)
}
